package com.gmtx.syb.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.gmtx.syb.R;

/**
 * Created by Administrator on 2016/11/15.
 */

public class RequestLoginDialog extends Dialog {
    private static RequestLoginDialog requestLoginDialog;

    public RequestLoginDialog(Context context) {
        super(context);
    }


    public static Dialog getRequestLoginDialog(Context context){
        if (requestLoginDialog == null) {
            requestLoginDialog = new RequestLoginDialog(context);
            View contentView = LayoutInflater.from(context).inflate(R.layout.layout_request_dialog, null);
            requestLoginDialog.setContentView(contentView);
        }
        return requestLoginDialog;
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if (requestLoginDialog == null){
            return;
        }
        ImageView imageView = (ImageView) requestLoginDialog.findViewById(R.id.loadingImageView);
        AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
        animationDrawable.start();
    }
}
